package com.lzx.orderserver.feign;

import com.lzx.commons.entity.Payment;
import com.lzx.commons.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

// 什么当前类是一个 Feign 客户端，指定服务名为
@Component
@FeignClient("PAYMENTSERVER")
public interface PaymentFeign {
    // 相当于为我们拼接了调用的完整URL地址
    // String url = "http://USER/info";
    @GetMapping("/payment/get")
    Result<Payment> info(@RequestParam("id") Integer id);

    @GetMapping("/payment/list")
    Result<List<Payment>> list();

    @RequestMapping(value = "/payment/save",method = RequestMethod.POST)
    Result save(@RequestBody Payment payment);
}
